/*******************************************************************************
 *                                    ZLG
 *                         ----------------------------
 *                         innovating embedded platform
 *
 * Copyright (c) 2001-present Guangzhou ZHIYUAN Electronics Co., Ltd.
 * All rights reserved.
 *
 * Contact information:
 * web site:    https://www.zlg.cn
 *******************************************************************************/
#ifndef __HPM_XPI_H__
#define __HPM_XPI_H__
#include "driver/romapi/hpm_romapi.h"

/**
 * \brief ROM XPI 是否空闲
 *
 * \param[in] p_reg_base XPI 基地址
 *
 * \retval 空闲返回 TRUE，否则返回 FALSE
 */
static inline bool_t rom_xpi_is_idle(XPI_Type *p_reg_base){
    return ROM_API_TABLE_ROOT->xpi_driver_if->is_idle(p_reg_base);
}

/**
 * \brief ROM XPI 传输阻塞
 *
 * \param[in] p_reg_base XPI 基地址
 * \param[in] p_xfer     XPI 传输环境
 *
 * \retval 成功返回 0
 */
static inline hpm_stat_t rom_xpi_transfer_blocking(XPI_Type *p_reg_base, xpi_xfer_ctx_t *p_xfer){
    return ROM_API_TABLE_ROOT->xpi_driver_if->transfer_blocking(p_reg_base, p_xfer);
}

/**
 * \brief ROM XPI 指令表更新
 *
 * \param[in] p_reg_base  XPI 基地址
 * \param[in] p_inst_base 指令表
 * \param[in] seq_idx     指令表序列索引
 * \param[in] num         指令表号
 *
 * \retval 成功返回 0
 */
static inline hpm_stat_t rom_xpi_update_instr_table(XPI_Type       *p_reg_base,
                                                    const uint32_t *p_inst_base,
                                                    uint32_t        seq_idx,
                                                    uint32_t        num){
    return ROM_API_TABLE_ROOT->xpi_driver_if->update_instr_table(p_reg_base, p_inst_base, seq_idx, num);
}

#endif

